package com.aruba.mvvmapplication.database

import androidx.paging.PagingSource
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.aruba.mvvmapplication.entity.MovieEntity

/**
 * Created by aruba on 2021/9/24.
 */
@Dao
interface MovieDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(movieList: List<MovieEntity>)

    @Query("SELECT * FROM MovieEntity")
    fun getMovieList(): PagingSource<Int, MovieEntity>

    @Query("DELETE FROM MovieEntity")
    suspend fun clear()
}